﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Oracle.DataAccess;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Client.SqlGen;
using Oracle.DataAccess.Types;
using System.Data;


namespace OracleHandler
{
    public class OracleSyncHandler
    {
        public static void Test()
        {
            try
            {
                string insertCommand = "Insert into TransMaster_MaintenanceCharges Values (999,20,250,'MRCHSL/VCHR/','head_income','transaction_mode_cheque', '25-Jun-2013','27-Jun-2013', 50000.25, 'bank_name_icici', 212121, 'bank_name_union','25-Jun-2013', 'excellent narration', 'D', 604)";
                
                string connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=admin-pc)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)));User Id=scott;Password=tiger;";
                
                string oradb = "Data Source=Oracle;User Id=scott;Password=tiger;";
                OracleConnection oracleConnection = new OracleConnection(connectionString);
                oracleConnection.Open();

                OracleCommand cmd = new OracleCommand();
                cmd.Connection = oracleConnection;
                cmd.CommandText = "select * from TransMaster_MaintenanceCharges";
                //cmd.CommandText = insertCommand;
                cmd.CommandType = CommandType.Text;
                //int rowsAffected = cmd.ExecuteNonQuery();
                
                OracleDataReader dr = cmd.ExecuteReader();
                dr.Read();
                int id = dr.GetInt32(0);
                oracleConnection.Dispose();
            }
            catch (Exception ex)
            {

            }
        }
    }
}
